﻿angular.module("umbraco.resources").factory("configurationResource",
    function ($q, $http, umbRequestHelper) {

        return {

            getConfiguration: function () {
                return umbRequestHelper.resourcePromise(
                    $http.get("backoffice/UmbracoDealer/BackendDealerConfiguration/Get")
                    , "Failed to get configuration data."
                );
            },

            saveConfiguration: function (platform, appkey, listview) {
                return umbRequestHelper.resourcePromise(
                    $http.put("backoffice/UmbracoDealer/BackendDealerConfiguration/Put"
                        , { MapPlatform: platform, MapAppKey: appkey, ListView: listview } )
                    , "Failed to change configuration data."
                );
            }
        };
    });